home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / WMS.CAB / plugin_action.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  9.0 KB  |  196 lines

  1. ∩╗┐<%@ Language=VBScript CODEPAGE=65001 %>
  2. <!--#include file="include/wmsLocStrings.inc"-->
  3. <!--#include file="include/wmsServerHash.inc"-->
  4. <!--#include file="include/wmsPlugins.inc"-->
  5. <!--#include file="include/wmsHeader.inc"-->
  6. <!--#include file="include/wmsPageBanner.inc"-->
  7. <!--#include file="include/wmsError.inc"-->
  8. <!--#include file="plugin_loading.inc"-->
  9. <%
  10. '+-------------------------------------------------------------------------
  11. '
  12. '  Microsoft Windows Media
  13. '  Copyright (C) Microsoft Corporation. All rights reserved.
  14. '
  15. '  File:       Plugin_Action.asp
  16. '
  17. '  Contents:
  18. '
  19. '--------------------------------------------------------------------------
  20.  
  21. ConnectToPlugin
  22. ClearError
  23. Dim strPluginIndex
  24. strPluginIndex = qs( "pluginIndex" )
  25. strPluginIndex = Left( strPluginIndex, 50 ) ' fail-safe
  26.  
  27. on error resume next
  28.  
  29. select case qs("op")
  30.     case "disable"
  31.         DisablePlugin FALSE
  32.     case "remove"
  33.         RemovePlugin
  34.     case "properties"
  35.         RedirectToProperties
  36.     case "refresh"
  37.         RefreshPluginList
  38.     case Else
  39.         Response.Redirect( "..\..\admin.asp?server=" & g_strQueryStringServer & "&category=" & g_strCategory & "&ppID=" & g_strPubPointID & "&pluginIndex=" & strPluginIndex )
  40. end select
  41.  
  42.  
  43. '//////////////////////////////////////////////////////////////////////////
  44. Sub RefreshPluginList()
  45.     on error resume next
  46.     g_objPluginCollection.Refresh
  47.  
  48.     if( TRUE = IsEmpty( g_objPubPoint ) ) then
  49.         Response.Redirect( "../server_props.asp?server=" & g_strQueryStringServer & "&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & "&op=refresh" )
  50.     else
  51.         Response.Redirect( "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & "&op=refresh" )
  52.     end if
  53.     Response.Flush
  54. end Sub
  55.  
  56. '//////////////////////////////////////////////////////////////////////////
  57. Sub DisablePlugin( bRedirectedFromRemove )
  58.     on error resume next
  59.     Dim strQueryStringSuffix
  60.     Dim szPrompted
  61.     Dim bPluginInError
  62.  
  63.     szPrompted = CStr( trim( qs( "prompted" ) ) )    
  64.     strQueryStringSuffix = "&s=true"
  65.  
  66.     bPluginInError = ( 0 <> ( CInt( WMS_PLUGIN_ERROR ) and g_objPlugin.Status ) )
  67.     
  68.     if( ( TRUE = g_objPlugin.Enabled ) or ( TRUE = bPluginInError ) ) then
  69.  
  70.         if ( TRUE = bPluginInError ) then
  71.             strQueryStringSuffix = strQueryStringSuffix & "&prompted=yes"
  72.             g_objPlugin.Enabled = FALSE
  73.         else
  74.             if( "" = qs("result") ) or ( TRUE = bRedirectedFromRemove ) then
  75.                 Dim szCritical
  76.                 szCritical = g_objPlugin.Properties( "WMSCriticalSystemPlugin" )
  77.                 Err.Clear
  78.                 if( 1 <> szCritical )then   ' straight-forward Remove operation
  79.                     g_objPlugin.Enabled = FALSE
  80.                     if( 0 <> err.number ) then
  81.                         ' ugly but necessary
  82.                         Session( "ErrDisablePluginDesc" ) = err.Description
  83.                         Session( "DisableError" ) = CDbl( err.number )
  84.                         strQueryStringSuffix = strQueryStringSuffix & "&op=disable"
  85.                     end if
  86.                     
  87.                     if( TRUE = IsEmpty( g_objPubPoint ) ) then
  88.                         Response.Redirect( "../server_props.asp?server=" & g_strQueryStringServer & "&category=" & qs("category") & strQueryStringSuffix & "&pluginIndex=" & strPluginIndex )
  89.                     else
  90.                         Response.Redirect( "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & strQueryStringSuffix & "&pluginIndex=" & strPluginIndex )
  91.                     end if
  92.                 end if
  93.             end if
  94.  
  95.             if( bRedirectedFromRemove ) then
  96.                 szReferrer = "&path=" & Server.URLPathEncode( "/wmssecure/pages/plugins/plugin_action.asp" )
  97.                 Response.Redirect( "../alert.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & "&op=" & OP_DISABLECRITSYSPLUGIN & szReferrer )
  98.             elseif( "0" = trim( qs("result") ) ) then ' we've already prompted the user, and they just wanted to disable the plug-in
  99.             ' Ask if they want to disable a critical system plug-in
  100.                 strQueryStringSuffix = strQueryStringSuffix & "&prompted=yes"
  101.                 g_objPlugin.Enabled = FALSE
  102.             elseif( "1" = trim( qs("result") ) ) then
  103.                 strQueryStringSuffix = strQueryStringSuffix & "&prompted=yes"
  104.             else
  105.                 szReferrer = "&path=" & Server.URLPathEncode( "/wmssecure/pages/plugins/plugin_action.asp" )
  106.                 Response.Redirect( "../alert.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & "&op=" & OP_DISABLECRITSYSPLUGIN & szReferrer )
  107.             end if
  108.         end if    
  109.     end if
  110.  
  111.     if( TRUE = IsEmpty( g_objPubPoint ) ) then
  112.         Response.Redirect( "../server_props.asp?server=" & g_strQueryStringServer & "&category=" & qs("category") & "&op=disable" & strQueryStringSuffix & "&pluginIndex=" & strPluginIndex )
  113.     else
  114.         Response.Redirect( "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & "&op=disable" & strQueryStringSuffix & "&pluginIndex=" & strPluginIndex )
  115.     end if
  116.     Response.Flush
  117. end sub
  118.  
  119.  
  120. '//////////////////////////////////////////////////////////////////////////
  121. Sub RemovePlugin()
  122.     on error resume next
  123.     Dim strQueryStringSuffix
  124.     Dim bPluginInError
  125.     bPluginInError = FALSE
  126.     
  127.     strQueryStringSuffix = ""
  128.  
  129.     g_objPluginCollection.Remove( g_strPluginName )
  130.  
  131.     ' We cannot remove the last instance of a type of plugin.
  132.     if( 0 <> err.number )then
  133.         strQueryStringSuffix = CStr( "&op=remove" )
  134.         Session( "RemoveError" ) = "remove"
  135.         err.clear
  136.         if( 0 = StrComp( "0", trim( qs("result") ), vbTextCompare ) )then   ' we've already prompted the user, and they just wanted to disable the plug-in
  137.             DisablePlugin TRUE 
  138.             Exit Sub
  139.             g_objPlugin.Enabled = FALSE
  140.             strQueryStringSuffix = strQueryStringSuffix & "&prompted=yes"
  141.         elseif( 0 = Len( trim( qs( "result" ) ) ) )then
  142.             if( bPluginInError or ( TRUE = g_objPlugin.Enabled ) )then  ' ask if they just want to disable the plug-in
  143.                 szReferrer = "&path=" & Server.URLPathEncode( "/wmssecure/pages/plugins/plugin_action.asp" )
  144.                 Response.Redirect( "../alert.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & "&op=" & OP_REMOVE_PLUGINERRDIS & szReferrer )
  145.             end if
  146.         else
  147.             strQueryStringSuffix = strQueryStringSuffix & "&prompted=yes"
  148.         end if
  149.     else
  150.         strQueryStringSuffix = CStr( "" )
  151.     end if
  152.     
  153.     if( TRUE = IsEmpty( g_objPubPoint ) ) then
  154.         Response.Redirect( "../server_props.asp?server=" & g_strQueryStringServer & "&ppID=&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & strQueryStringSuffix )
  155.     else
  156.         Response.Redirect( "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & qs("category") & "&pluginIndex=" & strPluginIndex & strQueryStringSuffix )
  157.     end if
  158.     Response.Flush
  159. end sub
  160.  
  161.  
  162. '//////////////////////////////////////////////////////////////////////////
  163. sub RedirectToProperties    
  164.     on error resume next
  165.     
  166.     Dim strRedirect
  167.     Dim bAdminPageExists
  168.     Dim strArguments
  169.     
  170.     strArguments = "?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & g_strCategory & "&referrer=" & Server.URLEncode( qs("referrer") ) & "&pendingOp=" & qs("pendingOp")
  171.     strRedirect = g_objPlugin.Properties("ASPMoniker")
  172.     bAdminPageExists = CBool( 0 < Len( strRedirect ) )
  173.     
  174.     if( bAdminPageExists ) then
  175.         bAdminPageExists = CBool( 0 < Len( Server.MapPath( strRedirect ) ) )
  176.     end if
  177.     
  178.     if( bAdminPageExists and ( 0 = err.number ) ) then
  179.         strRedirect = strRedirect & strArguments & "&pluginIndex=" & strPluginIndex
  180.         Response.Redirect( strRedirect )
  181.     else
  182.         if( empty = g_objPubPoint ) then
  183.             Response.Redirect( "../server_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & g_strCategory & "&pluginIndex=" & strPluginIndex & "&err=nopluginui" & "&pendingOp=" & qs("pendingOp") )
  184.         else
  185.             Response.Redirect( "../pubpoints/pubpoint_props.asp?server=" & g_strQueryStringServer & "&ppID=" & g_strPubPointID & "&category=" & g_strCategory & "&pluginIndex=" & strPluginIndex & "&err=nopluginui" & "&pendingOp=" & qs("pendingOp") )
  186.         end if
  187.         Response.Flush
  188. '        Response.End
  189.     end if
  190. end sub
  191.  
  192. on error resume next
  193. PluginsASPCleanup
  194. strPluginIndex = nothing
  195. ClearError
  196. %>